Login |
Community Home > Delphi | |
Retrieving a list of installed Applications on
Windows - by Borland Developer Support Staff
Abstract: How to get a listing of all installed applications on a machine running Windows OS
procedure TForm1.Button1Click(Sender: TObject);
const
REGKEYAPPS = '\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall';
var
reg : TRegistry;
List1 : TStringList;
List2 : TStringList;
i, n : integer;
begin
reg := TRegistry.Create;
List1 := TStringList.Create;
List2 := TStringList.Create;
{Load all the subkeys}
with reg do
begin
RootKey := HKEY_LOCAL_MACHINE;
OpenKey(REGKEYAPPS, false);
GetKeyNames(List1);
end;
{Load all the Value Names}
for i := 0 to List1.Count -1 do
begin
reg.OpenKey(REGKEYAPPS + '' + List1.Strings[i],false);
reg.GetValueNames(List2);
{We will show only if there is 'DisplayName'}
n := List2.IndexOf('DisplayName');
if (n <> -1) and (List2.IndexOf('UninstallString') <> -1) then
begin
ListBox1.Items.Add((reg.ReadString(List2.Strings[n])));
end;
end;
List.Free;
List2.Free;
reg.CloseKey;
reg.Destroy;
end;
Add or View comments on this article
Products:
Borland Delphi
5.x
Platforms:
Windows 2000 1.0;
Windows 98 1.0; Windows NT 4.0 SP5
Article ID: 27953 Publish Date: October 30, 2001 Last Modified: November 01, 2001
AppServer | C++ | CORBA | Delphi | InterBase | Java | Linux
Books | Chat | Code
Central | Downloads |
Feedback Help | Home Pages | Museum | Newsgroups | Shopping |